<template>
  <div>
    <div class="basepadding">客户管理</div>
    <div class="basepadding">
      <ztable
        ref="tablez"
        v-loading="tableloading"
        :datas="USearchs24"
        :tablecolumn="tablecolumn"
      >
        <template #setting="setting">
          <el-table-column
            align="center"
            :label="setting.itemdata.label"
            :prop="setting.itemdata.value"
          >
            <template #default="scope">
              <el-button
                size="small"
                type="primary"
                @click="ShopUserwpuUsereditfn(scope.row)"
              >
                详情
              </el-button>
            </template>
          </el-table-column>
        </template>
      </ztable>
    </div>
    <shopuserwpuuseredit ref="shopuserwpuuseredit" />
  </div>
</template>

<script>
  import ztable from '@/components/zTable'
  import shopuserwpuuseredit from './components/ShopUserwpuUseredit.vue'
  export default {
    components: {
      ztable,
      shopuserwpuuseredit,
    },
    data() {
      return {
        USearchs: [],
        tableloading: false,
        tablecolumn: [
          { label: '用户名', value: 'uUser' },
          { label: '联系人', value: 'uxm' },
          { label: '联系电话', value: 'utel' },
          { label: '操作', value: 'setting' },
        ],
        //
      }
    },
    computed: {
      USearchs0() {
        return this.USearchs.filter(function (e) {
          return e.utype == 0
        })
      },
      USearchs24() {
        return this.USearchs.filter(function (e) {
          return e.utype == 24
        })
      },
    },
    mounted() {
      this.getdata()
    },
    methods: {
      async getdata() {
        let { data } = await this.$z.$axios.post('/USearch', {
          b_pt: 1,
          sutype: `utype in (0, 24)`,
        })
        this.USearchs = data
      },
      ShopUserwpuUsereditfn(uUser) {
        this.$refs.shopuserwpuuseredit.show(uUser, this.USearchs0)
      },
    },
  }
</script>
<style lang="scss">
  @import '@/styles/tablecss.scss';
</style>
